<?php

class tplFormapiclient extends StudyBuddy\Template\Template
{

	/**
	 * Preserve state of "selected" value
	 * of radio button 'app_type'
	 * 
	 * 
	 * @param array $a
	 */
	protected static function func(&$a){

		if('b' === $a['app_type']){
			$a['selected_b'] = 'checked';
		} elseif ('c' === $a['app_type']){
			$a['selected_c'] = 'checked';
		}
	}
	
	
	protected static $vars = array(
	'token' => '', // 1
	'formTitle' => 'Register an Application', //2
	'app_id' => '0', //3
	'app_name' => '', //4
	'app_name_l' => 'Application Name', //5
	'appsite' => '', //6
	'appsite_l' => 'Application Website', //7
	'company' => '', // 8
	'company_l' => 'Organization', //9
	'about' => '', //10
	'about_l' => 'Description', // 11
	'submit' => 'Save Application Settings', // 12
	'selected_b' => '', //13
	'selected_c' => '', //14
	'app_type_l' => 'Application type', //15
	'app_type_d' => '', //16
	'formError' => '', //17
	'maxUploadSize' => '700000', //18
	'icon_image' => '/images/app2.png', //19
 	'icon_e' => '', //20
	'app_name_e' => '', //21
	'captcha' => '', //22
	'app_type' => '', // 23
	'app_type_e' => '', // 24
	'required_l' => 'Required', // 25
	'icon' => '' //26 Need this or Form class will complain about field does not exist
	);
	
	protected static $tpl = '
	<form name="epForm" method="POST" action="/index.php" enctype="multipart/form-data" accept-charset="utf-8">
		<input type="hidden" name="a" value="editapp">
		<input type="hidden" name="app_id" value="%3$s">	
		<input type="hidden" name="token" value="%1$s">
<div id="tools" class="form_wrap">
<h1>%2$s</h1>
<div class="form_error">%17$s</div>

<table class="larger vtop eprofile">
<tr>
	<td>%5$s</td>
	<td><input tabindex="10" type="text" size="30" id="id_app" name="app_name" value="%4$s">
	<span class="f_err">%21$s</span></td>
</tr>
<tr><td>%7$s</td><td><input tabindex="11" type="text" size="30" id="id_appsite" name="appsite" value="%6$s"></td></tr>
<tr><td>%9$s</td><td><input tabindex="12" type="text" size="30" id="id_company" name="company" value="%8$s"></td></tr>
<tr><td>%15$s<br><strong>(*) %25$s</strong></td>
<td>
<input tabindex="14" type="radio" value="b" name="app_type" %13$s> Browser 
<input tabindex="13" type="radio" value="c" name="app_type" %14$s> Client <br>
<p>Does your application run in a Web Browser or a Desktop Client?<br> 
              <small>Browser uses a Callback URL to return to your App after successful authentication.<br> 
              Client prompts your user to return to your application after approving access.</small></p> 
              <span class="f_err">%24$s</span>
</td>
</tr>

<tr><td>%11$s</td><td><textarea tabindex="18" id="id_about" rows="3" cols="40" class="com_body" name="about">%10$s</textarea>
   <br><span class="smaller">Maximum 300 characters. No HTML</span>             
 </td></tr>
 <tr>
 	<td>Application icon
 	<div class="fl cb">
 		<img src="%19$s" width="72px" height="72px" alt="App Logo" class="fl img_avatar">
 	</div>
 	</td>
 	<td>
 	<div class="fl cb">
 	<input type="hidden" name="MAX_FILE_SIZE" value="%18$s">
 	<input tabindex="19" type="file" size="30" id="id_icon" name="icon">
 	<span class="f_err">%20$s</span>
  	<p class="smaller">Maximum size of 700k.  JPG, GIF, PNG.<br>Your can upload this later!</p> 
  	</div>
  	</td>
 </tr>
 <!-- captcha -->
    <tr>
	<td></td>
	<td><div class="form_el">
			%22$s
         </div>
    </td>
    </tr>
  <!-- //captcha -->
<tr>
	<td></td>
	<td><div class="form_el">
            <input tabindex="20" id="dostuff" name="submit" type="submit" value="%12$s" class="btn btn-m"> 
         </div>
    </td>
 </tr>
</table>
</div>
</form>
	';
}
